package dailytest;

import java.util.Calendar;
import java.util.Date;

/**
 * @author: heweiwei
 * @Date: 2023/11/28 10:42
 * @Desc:
 */
public class MapTest {


    public static void main(String[] args) {
        Integer weekDayValue = getWeekDayValue(new Date());
        System.out.println("weekDayValue = " + weekDayValue);
    }


    public static Integer getWeekDayValue(Date sourceDate) {
        Calendar cal = Calendar.getInstance();
        cal.setTime(sourceDate);
        int sourceValue = cal.get(Calendar.DAY_OF_WEEK);

        if (sourceValue == 1) {
            sourceValue = 7;
        } else {
            sourceValue = sourceValue - 1;
        }

        return sourceValue;
    }

}
